<?php
$form = $this->form;
$this->headTitle('ACL :: Add role');
$this->headScript()->appendFile($this->baseUrl('scripts/jquery.min.js'));
$this->headScript()->appendFile($this->asset('scripts/add-roles.js', 'acl'));
$this->headScript()->captureStart();
?>
    init(jQuery, {
        selParents: '#selected',
        selRoles: '#role_parents',
        roles: {
            'foo': {label: 'foo', parents: []},
            'bar': {label: 'bar', parents: []},
            'baz': {label: 'baz', parents: ['bar']},
            'bat': {label: 'bat', parents: ['foo', 'bar']},
            'quux': {label: 'quux', parents: ['baz', 'bat']},
        },
    });
<?php
$this->headScript()->captureEnd();
?>

<h1>Define role</h1>
    
<?= $form->renderForm(false) ?>

<dl class="mz-form">
    <dt>
        <?= $form->role_id->renderLabel() ?>
    </dt>
    <dd>
        <?= $form->role_id->renderViewHelper() ?>
        <?= $form->role_id->renderErrors() ?>
    </dd>

    <dt>
        <?= $form->role_desc->renderLabel() ?>
    </dt>
    <dd>
        <?= $form->role_desc->renderViewHelper() ?>
        <?= $form->role_desc->renderErrors() ?>
    </dd>

    <dt>
        <?= $form->role_parents->renderLabel() ?>
    </dt>
    <dd>
        <?= $form->role_parents->renderViewHelper() ?>
        <div class="column notes">
            <h3>Notes:</h3>
            <ul>
                <li>
                    The order in which the parent roles are declared
                    <strong>IS</strong> important!
                </li>
                <li>
                    When selecting a role, all ancestors of that role are grayed
                    out. Making a role a child of a role when the latter is already
                    in the former's ancestry is redundant, but there's no harm
                    in doing so.
                </li>
            </ul>
        </div>
        <div class="cleared"></div>
    </dd>

    <dt>
        <?= $form->selected->renderLabel() ?>
    </dt>
    <dd>
        <?= $form->selected->renderViewHelper() ?>
    </dd>
    
    <dd>
        <?= $form->submit->renderViewHelper() ?>
    </dd>
</dl>
<?= '</form>' // totally superfluous, but i hate seeing the red squiggly line in netbeans ?>
